package top.kaoshanji.r2ch07c;

import top.kaoshanji.r2ch07b.ForumService;

import java.lang.reflect.Proxy;

/**
 * 代码清单-r2ch07c-226页a：为ForumServiceImpl创建代理类
 * @author kaoshanji
 * ^_^
 * create time 2025/5/7 15:02
 */
public class ForumServiceImplMain {

    public static void main(String[] args) {

        ForumService target = new ForumServiceImpl();

        PerformanceHandler handler = new PerformanceHandler(target);

        ForumService proxy = (ForumService)Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), handler);

        proxy.removeForum(10);
        proxy.removeTopic(1012);

    }

}
